home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume4 / tmac.ti < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  21.4 KB

  1. Subject: travel-itinerary macros for nroff
  2. From: Jerry Peek (Tek CSC Training) <tektronix!tektools!jerryp>
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 4, Issue 75
  7. Submitted by: Jerry Peek (Tek CSC Training) <tektronix!tektools!jerryp>
  8.  
  9. Here's a package of nroff/troff macros that makes itineraries for trips by car.
  10. For an example of the way they work, see the man page below.
  11. There's also an announcement/example on net.travel and net.sources.
  12.  
  13. A quick overview:  You give them a starting day/date, tell them how
  14. much gas costs (dollars, francs, etc.) and your car's fuel economy
  15. (miles/gallon or kilometres/litre).  Then, you make an entry for each day.
  16. The macros keep daily and running totals of miles driven and the cost.
  17. There are other macros included for food, lodging, and miscellaneous expenses.
  18.  
  19. --Jerry Peek, Tektronix, Inc.
  20. US Mail:    MS 74-222, P.O. Box 500, Beaverton, OR 97077
  21. uucp:       {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
  22. CS,ARPAnet: jerryp%tektools@tektronix.csnet
  23. Phone:      +1 503 627-1603
  24.  
  25. P.S.  I'm no expert on n/troff macros [is anyone? :-)], but several people
  26. around here (including me) have used them, and they seem to work fine.
  27. Suggestions, bug fixes, etc. are welcome, though!  Still, here's the usual
  28. disclaimer about no guarantee of performance, suitability, etc. etc.
  29.  
  30.  
  31. ======== CUT ======== HERE ======== AND ====== FEED ====== TO ===== sh ========
  32. #! /bin/sh
  33. # This is a shell archive, meaning:
  34. # 1. Remove everything above the #! /bin/sh line.
  35. # 2. Save the resulting text in a file.
  36. # 3. Execute the file with /bin/sh (not csh) to create the files:
  37. #    mti.7
  38. #    tmac.ti
  39. # This archive created: Mon Apr 21 10:22:23 1986
  40. export PATH; PATH=/bin:$PATH
  41. echo shar: extracting "'mti.7'" '(13115 characters)'
  42. if test -f 'mti.7'
  43. then
  44.     echo shar: will not over-write existing file "'mti.7'"
  45. else
  46. cat << \SHAR_EOF > 'mti.7'
  47. .de xX    \" automatic revision-date macro
  48. .ds Da \\$4
  49. ..
  50. .xX $Header: mti.7,v 1.6 86/02/09 14:45:48 jerryp Exp $
  51. .\"
  52. .TH MTI 7 "\*(Da"
  53. .UC 4
  54. .SH NAME
  55. mti \- travel-itinerary formatting macros
  56. .SH SYNOPSIS
  57. \fBnroff  \-mti\fP  [ \-rQ2 ]  [ options ]  file  ...
  58. .br
  59. \fBtroff  \-mti\fP  [ \-rQ2 ]  [ options ]  file  ...
  60. .SH DESCRIPTION
  61. This package of \fInroff\fP\| and \fItroff\fP\|
  62. macro definitions makes formatted travel itineraries.
  63. They're especially designed for road trips \(em 
  64. through they'll work for other kinds of travel, too.
  65. .PP
  66. You give them the starting date, the time and mileage points you'll
  67. hit each day, and each food/lodging expense you plan.
  68. (You also need to store the cost of travelling \(em usually fuel economy,
  69. with other fixed traveling expenses optional).
  70. They'll output an itinerary that lists each timepoint and expense,
  71. as well as daily and running totals of cost and distance.
  72. .SH EXAMPLE
  73. Here's a small part of a finished (fictional) itinerary, with `. . .' in place
  74. of the omitted lines:
  75. .nf
  76. '\" kludges to make .tl titles line up with current margins:
  77. .lt -0.5i
  78. .po +0.5i
  79. .ft B
  80.       .
  81.       .
  82. .tl'ITINERARY'Page 6'CROSS-COUNTRY MOVE'
  83.       .
  84.       .
  85. .in -0.5i
  86. 6 PM  Camp near Dustbowl, NM
  87. LODGING: Camping fee  $8.
  88.  
  89. TODAY: 415 mi. in 9 hours for $18; other costs $8; total $26
  90. TO DATE: 1690 miles, $77
  91. \l'6i\(em'
  92. DAY #7 OF TRIP: Friday, 6/21
  93. .in
  94.  
  95. .tl '7 AM  NM-18, US-87 to Dalhart, TX''129 mi'
  96. .tl '9 AM  Time-zone change from MDT to CDT'''
  97. .tl '10 AM  TX-297, TX-281, US-22, US-83 to Canadian, TX''135 mi'
  98. .tl 'FOOD: Lunch in Canadian?  $6.'''
  99. .tl '1 PM  US-83, OK-54, I-40 to Oklahoma City''140 mi'
  100. .in -0.5i
  101. 4 PM  Arrive at Fred Smith's home
  102.  
  103. TODAY: 404 mi. in 8 hours for $17; other costs $6; total $23
  104. TO DATE: 2094 miles, $100
  105. \l'6i\(em'
  106. DAY #8 OF TRIP: Saturday, 6/22
  107.       .
  108.       .
  109. '\" if this line crosses a page boundary, page footer/header will be indented!
  110. .ft P
  111. .in
  112. .lt +0.5i
  113. .po -0.5i
  114. .fi
  115. .ad
  116. .PP
  117. The source (unformatted) itinerary commands are flexible enough that it's easy
  118. to rearrange your itinerary, try alternate routes, etc... after you've set up
  119. an itinerary, the macros will calculate the total trip length and expenses.
  120. .PP
  121. For example, here are the lines that produced the itinerary above.
  122. Start each day with \fI.SD\fR, use \fI.EN\fR for each entry, and
  123. use \fI.ED\fR at the end of each day.
  124. Lodging expenses are marked with \fI.LO\fR, and \fI.FO\fR is for food:
  125. .nf
  126. .na
  127. .ft B
  128. .sp
  129.   .EN 6 PM "Camp near Dustbowl, NM"
  130.   .LO "Camping fee" 8
  131.   .ED 9
  132.   .SD
  133.   .EN 7 AM "NM-18, US-87 to Dalhart, TX" 129
  134.   .EN 9 AM "Time-zone change from MDT to CDT" 0
  135.   .EN 10 AM "TX-297, TX-281, US-22, US-83 to Canadian, TX" 135
  136.   .FO "Lunch in Canadian?" 6
  137.   .EN 1 PM "US-83, OK-54, I-40 to Oklahoma City" 140
  138.   .EN 4 PM "Arrive at Fred Smith's home" 0
  139.   .ED 8
  140.   .SD
  141. .ft P
  142. .fi
  143. .ad
  144. .sp
  145. The argument to ED is the number of hours spent traveling that day.
  146. The last argument to EN is the number of miles driven since the previous
  147. timepoint.
  148. .PP
  149. All the \fI\-mti\fR macros are defined below.
  150. It's okay to use most \fInroff\fP\| and \fItroff\fP\| requests
  151. with this package.
  152. However, watch out for fill- and non-fill modes, because
  153. the macros switch back and forth between the two modes.
  154. See the individual macro descriptions below.
  155. Also, be careful about setting number and string registers:
  156. the macros use a few of them (see the list below).
  157. .PP
  158. Font and point size changes with \ef and \es are also allowed;
  159. for example, ``\efIword\efR'' will italicize \fIword.\fP
  160. .SH OPTION
  161. If you use \fI\-rQ2\fR on the commandline, the macros won't print the
  162. \fBTODAY:\fR and \fBTO DATE:\fR summaries at the end of each day.
  163. Other commandline options go directly to \fInroff\fR or \fItroff\fR.
  164. .SH REGISTERS AND MACROS
  165. Here's a summary of the number and string registers \(em and the macros \(em
  166. that make up the
  167. .I \-mti
  168. macros.
  169. After the summary are detailed explanations and examples of each.
  170. So, beginners can safely skip this reference section for now.
  171. This list doesn't include internal macros and registers.
  172. .ne 5
  173. .tr _.
  174. .ta \w'Regist.Nam'u +\w'InitialVal'u +\w'String/ 'u
  175. .sp
  176. .nf
  177. Regist.    Initial    String/    \0 Explanation
  178. Name    Value    Number
  179. .sp .3
  180. _CS    $    str    currency-unit symbol
  181. _DT    \-    num    numerical date of trip start
  182. _DU    \-    num    distance per currency unit
  183. _DY    \-    str    name of day when trip starts
  184. _FD    \-    num    number days in February
  185. _MN    \_    num    numerical month of trip start
  186. _TI    \_    str    title for top corner each page
  187. _UL    miles    str    distance unit name, long
  188. _US    mi    str    distance unit name, short
  189. .sp 2
  190. .ta \w'MacroNam'u +\w'NumberAr'u +\w'ReqdOptl 'u
  191. .sp .3
  192. Macro    Number    Req'd/    \0 Explanation
  193. Name    Args.    Opt'nl
  194. .sp .3
  195. _ED    1    reqd    end of day
  196. _EN    4    reqd    timepoint entry
  197. _ET    0    reqd    end of title page
  198. _FO    2    optl    food expense
  199. _LO    2    optl    lodging expense
  200. _OE    2    optl    other expenses
  201. _SD    0    reqd    start of daily entry
  202. _ST    2    reqd    start of title block
  203. .fi
  204. .ie n .ta 0.8i 1.6i 2.4i 3.2i 4.0i
  205. .el .ta 0.5i 1i 1.5i 2i 2.5i 3i 3.5i 4i
  206. .SH "SOURCE-FILE DESCRIPTION"
  207. This part of the manual describes what you should put in a
  208. source (unformatted) itinerary file.
  209. .sp 2
  210. The \fBFIRST SECTION\fR of each file stores numbers and strings (words) that
  211. set the initial conditions (starting date, fuel economy, etc.).
  212. You can put these first few lines in any order, as long as they're all at
  213. the top of the file.
  214. Individual descriptions:
  215. .TP 12
  216. .B \&.ds DY Day
  217. .I Required:
  218. day of the week that trip starts.
  219. First letter of day must be capitalized, rest lower-case.
  220. No abbreviations.
  221. Example:
  222. .br
  223.     \fB.ds DY Saturday\fR
  224. .TP 12
  225. .B \&.nr DT Date
  226. .I Required:
  227. numerical date when the trip starts.
  228. For example, if the trip started on August 15th:
  229. .br
  230.     \fB.nr DT 15\fR
  231. .TP 12
  232. .B \&.nr MN Month\fR
  233. .I Required:
  234. numerical month that the trip starts (January = 1, February = 2, etc.).
  235. Example:
  236. .br
  237.     \fB.nr MN 8\fR
  238. .TP 12
  239. .B \&.nr DU xx
  240. .I Required:
  241. Distance you can travel for each currency-unit you spend (in the U.S.,
  242. number of miles that cost one dollar; in France, kilometres you can travel for
  243. one Franc; etc.).
  244. This rather weird number was designed to get around a problem:
  245. .I nroff
  246. and
  247. .I troff
  248. can't do decimal arithmetic -- only integers.
  249. Here are two examples that should clear things up:
  250. .sp
  251. On your trip across the U.S., you guess that you'll get 30 miles/gallon,
  252. and that gas will cost $1.25 per gallon.
  253. So, the miles per dollar are:
  254. .ft B
  255. .nf
  256. .na
  257. .sp
  258.         30 miles/gallon
  259.     -----------------------\0=\024\0miles/dollar
  260.       1.25 dollars/gallon
  261. .ad
  262. .fi
  263. .ft P
  264. .sp
  265. \&...which means that you'd put this line in your source file:
  266. .br
  267.     \fB.nr DU 24\fR
  268. .sp
  269. Or, if you were driving across Europe, getting 17 kilometres/litre and
  270. spending DKK 6- per litre, the setting of \fBDU\fP should be 17 divided by 6,
  271. or about 3 kilometres per DKK.
  272. So, you'd put this line in your itinerary:
  273. .br
  274.     \fB.nr DU 3\fR
  275. .TP 12
  276. .B \&.nr FD 2x
  277. .I Required:
  278. Number of days in February \(em 28 or 29.
  279. Tells program whether this is a leap year.
  280. Must be set, even if your itinerary doesn't include February.
  281. For example, if there are 28 days in February during the year of your trip (a
  282. non-leap year):
  283. .br
  284.     \fB.nr FD 28\fR
  285. .sp
  286. If your trip crosses two years but only one February, set FD for the 
  287. number of days in the February when you'll be traveling.
  288. .TP 12
  289. .B \&.ds TI TITLE
  290. .I Optional:
  291. title for upper right-hand corner of each page.
  292. If you don't define it, it'll be blank.
  293. Here's how you could define it:
  294. .br
  295.     \fB.ds TI CROSS-COUNTRY TRIP\fR
  296. .TP 12
  297. .B \&.ds CS xxx
  298. .I Optional:
  299. currency symbol (default = \fB$\fR).
  300. Can be set to other currency names, like \fISKR\fR, this way:
  301. .br
  302.     \fB.ds CR SKR\fR
  303. .sp
  304. This is used in the \fBTODAY:\fR and \fBTO DATE:\fR lines printed at the end
  305. of each day.
  306. .sp
  307. Normally, the currency symbol and the cost are printed touching each other,
  308. like \fB$123\fR or \fBhfl162\fR (Dutch Guilder).
  309. If you want space after the currency symbol (like \fBhfl\ 162\fR),
  310. use a backslash and a trailing blank when you define the currency symbol.
  311. For example,
  312. .br
  313.     \fB.ds CR hfl\e\ \fR
  314. .br
  315. Just be sure to put the blank after the backslash!
  316. .TP 12
  317. .B \&.ds US units
  318. .I Optional:
  319. the units of distance, short name.
  320. The default is \fImi\fR (miles)..
  321. To change it to, say, \fIkm\fR:
  322. .br
  323.     \fB.ds US km\fR
  324. .TP 12
  325. .B \&.ds UL units
  326. .I Optional:
  327. the units of distance, long name, plural.
  328. The default is \fImiles\fR.
  329. To change it to, say, \fIkilometers\fR:
  330. .br
  331.     \fB.ds UL kilometers\fR
  332. .PP
  333. .sp 2
  334. The \fBTITLE SECTION\fR is usually short.
  335. It starts with the \fI.ST\fR macro, and ends with \fI.ET\fR.
  336. If you want other text on the title page, you can put it between the macro
  337. calls.
  338. .TP 12
  339. \fB\&.ST\0"First line"\0"Second line"\fR
  340. .I Required:
  341. after you've set the number and string registers in the first section,
  342. you must use \fI.ST\fR (start title page).
  343. If you want a title on the first page, it can have one or two lines...
  344. the macros will make it in larger type and center each line.
  345. .sp
  346. Quote each line of the title, and put the text on the same line as
  347. the \fI.ST\fR call.
  348. If you don't want one or both lines, just leave them out.
  349. Example:
  350. .br
  351.     \fB.sT\0"Our trip"\0"to Lower Slobovia"\fR
  352. .sp
  353. After the \fI.ST\fP, you can put text for the title page.
  354. You'll usually want to skip down a few lines (say, \fB.sp 5\fR)
  355. before starting the text.
  356. The title page is made in no-fill mode, so what you type in will be exactly
  357. what appears on the title page.
  358. You can start fill mode (\fB.fi\fR and maybe \fB.ad\fR), but BE SURE to
  359. go back to non-fill mode (\fB.nf\fR) before you use the \fB.ET\fR macro!
  360. .TP 12
  361. .B \&.ET
  362. .I Required:
  363. At the end of the title page (after the \fB.ST\fP and the optional text),
  364. end the title page with \fB.ET\fR.
  365. .PP
  366. .sp 2
  367. The last part of the file are the \fBDAILY ENTRIES\fR, which are enclosed
  368. with \fB.SD\fR and \fB.ED\fR macro calls.  Here are the details:
  369. .TP 12
  370. .B \&.SD
  371. Each day's entry must start with the \fI.SD\fR macro.
  372. Put it on a line by itself.
  373. .TP 12
  374. \fB\&.EN time AM/PM "description" distance
  375. .I Required:
  376. For each timepoint in a day, use the \fI.EN\fR (entry) macro.
  377. The first argument is the clock time, a number between 1 and 12 (though
  378. 24-hour time will work fine here).
  379. .sp
  380. If you use a 12-hour clock, the second argument should be AM, PM, NOON, or
  381. something like that.
  382. On a 24-hour clock, use your imagination.
  383. .sp
  384. You should put quotes around the third argument, which is usually the
  385. description of a route you're taking since the last timepoint.
  386. It can also hold the name of a destination.
  387. .sp
  388. The fourth argument must be a number \(em the distance travelled
  389. during this entry.
  390. (Or, in other words, the distance travelled since the previous entry.)
  391. .sp
  392. Here's an example.
  393. It's 10 AM and you're about to leave Auckland, New Zealand for a trip to
  394. Rotorua.
  395. The trip is via highways 3 and 12 and is 200 kilometres long (I'm making this
  396. up!).
  397. You'd write this \fI.EN\fP macro:
  398. .br
  399.     \fB.EN\010\0AM\0"Hwys. 3, 12 to Rotorua"\0200
  400. .TP 12
  401. \fB\&.FO "description" cost\fR
  402. .I Optional:
  403. When you plan to spend money for food, note it with \fI.FO\fR.
  404. You must use \fI.FO\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
  405. .sp
  406. Example: in the middle of the day, you plan to spend $55 for lunch for your tour
  407. group.
  408. You might use this entry:
  409. .br
  410.     \fB.FO "lunch at El Greaso, Dallas" 55\fR
  411. .TP 12
  412. \fB\&.LO "description" cost\fR
  413. .I Optional:
  414. When you plan lodging expenses, note them with \fI.LO\fR.
  415. Use \fI.LO\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
  416. .sp
  417. Example: You'll be staying at the Waldorf-Astoria tonight, spending $1000.
  418. You might use this entry, including the phone number for convenience:
  419. .br
  420.     \fB.LO "Waldorf-Astoria, 212/345-2999" 1000\fR
  421. .TP 12
  422. \fB\&.OE "description" cost\fR
  423. .I Optional:
  424. The \fI.OE\fR (capital letter O) macro is for expenses besides food and
  425. lodging.
  426. You have to use \fI.OE\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
  427. .sp
  428. Example: You expect a transmission overhaul in Nairobi:
  429. .br
  430.     \fB.OE "Rebuild transmission" 550\fR
  431. .TP 12
  432. .B \&.ED total-time
  433. .I Required:
  434. At the end of each day's entries, use \fI.ED\fR with the total time spent
  435. traveling that day.
  436. This is usually the elapsed time between the first and last timepoints in the
  437. day \(em unless you're crossing time zones.
  438. .sp
  439. Example: If you started traveling at 9 AM and finished at 5 PM, that's 8
  440. hours of traveling:
  441. .br
  442.     \fB.ED 8\fR
  443. .TP 12
  444. .B lines with no macros
  445. If you don't use a macro on a line, the line will be copied directly
  446. to the itinerary without filling, adjusting, or wrapping.
  447. The lines may look better if you indent them with a tab character.
  448. .SH FILES
  449. /usr/lib/public/tmac/tmac.ti
  450. .SH SEE ALSO
  451. .IR ms (7),
  452. .IR nroff (1),
  453. .IR troff (1).
  454. .SH BUGS
  455. More default settings might be nice.
  456. Some parts could be shortened by using subroutines.
  457. Internal register names aren't unique enough and may conflict with any
  458. registers that the user defines.
  459. .SH AUTHOR
  460. Jerry Peek; Portland, Oregon.
  461. .PP
  462. I'm not an expert at formatter macros, so use these at your own risk.
  463. I'll take no responsibility for their accuracy or suitability for any purpose.
  464. .PP
  465. Bugs and rewrites to jerryp%tektools@tektronix.csnet or
  466. {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp.
  467. Flames will probably be ".ig"'ed.
  468. SHAR_EOF
  469. if test 13115 -ne "`wc -c < 'mti.7'`"
  470. then
  471.     echo shar: error transmitting "'mti.7'" '(should have been 13115 characters)'
  472. fi
  473. fi
  474. echo shar: extracting "'tmac.ti'" '(6340 characters)'
  475. if test -f 'tmac.ti'
  476. then
  477.     echo shar: will not over-write existing file "'tmac.ti'"
  478. else
  479. cat << \SHAR_EOF > 'tmac.ti'
  480. '\"    $Header: tmac.ti,v 1.26 86/02/15 11:20:14 jerryp Exp $
  481. '\"    $Source: /usr1/sys/usr/lib/public/tmac/tmac.ti,v $
  482. '\"
  483. '\"          ti travel-itinerary macros for nroff/troff
  484. '\"        Jerry Peek; Portland, OR; tektronix!tektools!jerryp
  485. '\"
  486. .nf
  487. .na
  488. '\" Set line length to 8 inches (nroff only) so ".EN" entries can be longer:
  489. .nr St 0    \" dumb register that counts use of ST and ET macros
  490. .if n \{\
  491. .ll 8i
  492. .lt 8i \}
  493. .nr MI 0    \" total miles/kilometers
  494. .nr MT 0    \" miles or km today
  495. .nr CO 0    \" total cost
  496. .nr CT 0    \" cost today
  497. .nr DA 0 1    \" total number of days and amount (1 day) to increment by
  498. '\" Units to use: miles or km.  UL is long, for daily summaries; US is short,
  499. '\" used on each line.  User can re-define in file; should be lower-case:
  500. .ds UL miles
  501. .ds US mi
  502. '\" Currency symbol.  User can re-define in file.
  503. '\" Can have several characters, including trailing blanks:
  504. .ds CS $
  505. '\" Start-itinerary macro.  $1 = title for first page.
  506. '\" $2 = optional second title line.
  507. .de ST
  508. '\" Check flag to see if user has already invoked ST macro.  If so, scream.
  509. '\" If not, set flag:
  510. .if !\\n(sT=0 .ER "only one .ST per file, please."
  511. .nr sT 1
  512. .if !\\n(eT=0 .ER "You must use the .ET macro after the .ST"
  513. '\" Because first .SD will increment starting day, decrement it here.
  514. '\" Also, be sure starting day name is valid (if valid, set cK to 0):
  515. .nr cK 1
  516. .if '\\*(DY'Sunday' \{\
  517. .ds Dy Saturday
  518. .nr cK 0\}
  519. .if '\\*(DY'Monday' \{\
  520. .ds Dy Sunday
  521. .nr cK 0\}
  522. .if '\\*(DY'Tuesday' \{\
  523. .ds Dy Monday
  524. .nr cK 0\}
  525. .if '\\*(DY'Wednesday' \{\
  526. .ds Dy Tuesday
  527. .nr cK 0\}
  528. .if '\\*(DY'Thursday' \{\
  529. .ds Dy Wednesday
  530. .nr cK 0\}
  531. .if '\\*(DY'Friday' \{\
  532. .ds Dy Thursday
  533. .nr cK 0\}
  534. .if '\\*(DY'Saturday' \{\
  535. .ds Dy Friday
  536. .nr cK 0\}
  537. .if \\n(cK .ER ".ST: day name DY is missing or invalid."
  538. .rr cK
  539. .rm DY
  540. .if \\n(DU<1 .ER ".ST: DU undefined or less than 1.  Can't calculate fuel cost."
  541. .if (\\n(FD<28):(\\n(FD>29) .ER ".ST: FD undefined, or not 28 or 29."
  542. .if (\\n(MN<1):(\\n(MN>12) .ER ".ST: MN (\\n(MN) undefined, less than 1 or more than 12."
  543. .if \\n(DT<1 .ER ".ST: starting date DT is less than 1 or not defined."
  544. '\" Put DT (starting date: 1, 2, ..., 31) in Dt (date register);
  545. '\" set Dt to one day before start of trip because first .SD will increment it:
  546. .nr Dt \\n(DT-1 1
  547. .rm DT
  548. .sp 1i
  549. .ps +4
  550. .ce 3
  551. ITINERARY \(em
  552. .sp 2
  553. \\$1
  554. .sp
  555. \\$2
  556. .ps
  557. '\" Don't print info below if user put -rQn on commandline:
  558. .if \\nQ=0 \{\
  559. .sp 2
  560. .ce 2
  561. The traveling costs in this itinerary are based on the assumption that
  562. each \\n(DU \*(UL travelled will cost one \\*(CS for gas, oil, etc.
  563. .sp \}
  564. ..
  565. .de ET    \" end of title page macro
  566. .ie !\\n(sT=1 .ER ".ET: You must use the ST macro first."
  567. .el .nr sT 0
  568. .ie !\\n(eT=0 .ER ".ET: Only one .ET per file."
  569. .el .nr eT 1
  570. '\" set eD register so that first .SD doesn't say "missing .ED":
  571. .nr eD 1
  572. .nr sD 0
  573. '\" Set page number to one so first page of itinerary will have that number:
  574. .pn 1
  575. .bp
  576. ..
  577. .de ER
  578. .fl
  579. ***********************
  580. .br
  581. ERROR at input line \\n(.c: \\$1
  582. .br
  583. ***********************
  584. .ex
  585. ..
  586. .de NP    \" new-page macro (from Kernighan tutorial, pg. 8)
  587. 'bp
  588. .ps +2
  589. 'sp 0.5i
  590. .if t .sp 0.3i    \" more space if using troff
  591. 'tl ITINERARYPage %\\*(TI
  592. 'sp 0.3i
  593. .ps
  594. ..
  595. .wh -1i NP    \" when get within 1 inch of page bottom, do NP (no . needed)
  596. '\" .HL draws em-dashes margin-to-margin.
  597. .de HL
  598. .br
  599. \l'\\n(.lu-\\n(.iu\&\(em'
  600. .br
  601. ..
  602. '\" Start-of-day macro
  603. .de SD
  604. .if !\\n(eT=1 .ER ".SD: You must use .ET first."
  605. .ie !\\n(eD=1 .ER ".SD: Missing .ED"
  606. .el .nr eD 0
  607. .ie !\\n(sD=0 .ER ".SD: Two .SD's with no .ED between"
  608. .el .nr sD 1
  609. .nr MT 0    \" set today's mileage (kilometrage?)  to zero
  610. .nr CT 0    \" set today's cost to zero
  611. '\" handle month changes
  612. .if \\n(MN=1  .if \\n(Dt>30\{
  613. .nr MN 2
  614. .nr Dt 0\}
  615. .if \\n(MN=2 .if \\n(Dt>(\\n(FD-1)\{\
  616. .nr MN 3
  617. .nr Dt 0\}
  618. .if \\n(MN=3  .if \\n(Dt>30\{
  619. .nr MN 4
  620. .nr Dt 0\}
  621. .if \\n(MN=4  .if \\n(Dt>29\{
  622. .nr MN 5
  623. .nr Dt 0\}
  624. .if \\n(MN=5  .if \\n(Dt>30\{
  625. .nr MN 6
  626. .nr Dt 0\}
  627. .if \\n(MN=6  .if \\n(Dt>29\{
  628. .nr MN 7
  629. .nr Dt 0\}
  630. .if \\n(MN=7  .if \\n(Dt>30\{
  631. .nr MN 8
  632. .nr Dt 0\}
  633. .if \\n(MN=9  .if \\n(Dt>29\{
  634. .nr MN 10
  635. .nr Dt 0\}
  636. .if \\n(MN=10  .if \\n(Dt>30\{
  637. .nr MN 11
  638. .nr Dt 0\}
  639. .if \\n(MN=11  .if \\n(Dt>29\{
  640. .nr MN 12
  641. .nr Dt 0\}
  642. .if \\n(MN=12  .if \\n(Dt>30\{
  643. .nr MN 1
  644. .nr Dt 0\}
  645. '\" change day
  646. .ie '\\*(Dy'Sunday' .ds Dy Monday
  647. .el .ie '\\*(Dy'Monday' .ds Dy Tuesday
  648. .el .ie '\\*(Dy'Tuesday' .ds Dy Wednesday
  649. .el .ie '\\*(Dy'Wednesday' .ds Dy Thursday
  650. .el .ie '\\*(Dy'Thursday' .ds Dy Friday
  651. .el .ie '\\*(Dy'Friday' .ds Dy Saturday
  652. .el .ds Dy Sunday
  653. '\" start keep (from Kernighan tutorial, pg. 12)
  654. .br    \" start fresh line
  655. .di Xx    \" collect text in diversion (macro) Xx
  656. DAY #\\n+(DA OF TRIP: \\*(Dy, \\n(MN/\\n+(Dt
  657. .sp
  658. ..
  659. '\" Entry macro.  $1 = hour, $2 = AM/PM/etc., "$3" = description, $4 = miles/km
  660. .de EN
  661. .if !\\n(sD=1 .ER ".EN: Missing .SD"
  662. .ie \\$4>0 .tl \\$1 \\$2\0\0\\$3\\$4 \*(US
  663. .el \\$1 \\$2\0\0\\$3
  664. .nr MT +\\$4
  665. ..
  666. '\" Food macro.  $1 = Description; $2 = cost in CS units, decimals truncated:
  667. .de FO
  668. .if !\\n(sD=1 .ER ".FO: Missing .SD"
  669. .nr CT +\\$2
  670. .br
  671. FOOD: \\$1  \\*(CS\\$2.
  672. ..
  673. '\" Lodging macro.  $1 = Description; $2 = cost in CS units, decimals truncated:
  674. .de LO
  675. .if !\\n(sD=1 .ER ".LO: Missing .SD"
  676. .nr CT +\\$2
  677. .br
  678. LODGING: \\$1  \\*(CS\\$2.
  679. ..
  680. '\" Other-expense macro.  $1 = Description; $2 = cost in CS units:
  681. .de OE
  682. .if !\\n(sD=1 .ER ".OE: Missing .SD"
  683. .nr CT +\\$2
  684. .br
  685. OTHER: \\$1  \\*(CS\\$2.
  686. ..
  687. '\" End of day macro.  $1 = number of hours today
  688. .de ED
  689. .ie !\\n(sD=1 .ER ".ED: Missing .SD"
  690. .el .nr sD 0
  691. .ie !\\n(eD=0 .ER ".ED: Two .ED's with no .SD between."
  692. .el .nr eD 1
  693. .if !\\n(.$=1 .ER ".ED: missing or too many arguments."
  694. .nr TT (\\n(MT/\\n(DU)    \" total travel cost = miles divided by miles/dollar 
  695. .nr OT \\n(CT        \" other total (TT not added in yet)
  696. .nr CT (\\n(TT+\\n(OT)    \" overwrite CT to hold total cost today: TT + OT
  697. .nr CO +\\n(CT        \" add today's cost to total trip cost
  698. .nr MI +\\n(MT        \" add today's miles (MT) to total trip miles (MI)
  699. .sp
  700. .fi
  701. '\" If -rQ1 was used on commandline, don't print lines:
  702. .if \\nQ=0 \{\
  703. TODAY:\0travel \\n(MT \\*(UL in \\$1
  704. .ie '\\$1'1' hour
  705. .el hours
  706. for \\*(CS\\n(TT; other costs \\*(CS\\n(OT; total \\*(CS\\n(CT
  707. .nf
  708. TO DATE:\0\\n(MI \\*(UL, \\*(CS\\n(CO \}
  709. .HL
  710. '\" end keep
  711. .br    \" get last partial line
  712. .di    \" end diversion
  713. .if \\n(dn>=\\n(.t .bp    \" do .bp if text doesn't fit on current page
  714. .Xx    \" bring back text stored in Xx macro
  715. ..
  716. SHAR_EOF
  717. echo shar: 8 control characters may be missing from "'tmac.ti'"
  718. if test 6340 -ne "`wc -c < 'tmac.ti'`"
  719. then
  720.     echo shar: error transmitting "'tmac.ti'" '(should have been 6340 characters)'
  721. fi
  722. fi
  723. exit 0
  724. #    End of shell archive
  725.